<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Date</title>
	<!--<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>-->
</head>
<body>
<script>
	let now = new Date();
	console.log("now:" + now);
	let fullYear = now.getFullYear();
	console.log("now.getFullYear():" + fullYear);
	let month = now.getMonth();
	//注意JavaScript的月份是从0开始的，0代表1月份，1代表2月份...
	console.log("now.getMonth():" + month);
	//返回的是天
	let date = now.getDate();
	console.log("now.getDate():" + date);
	//返回的是星期几
	let day = now.getDay();
	console.log("now.getDay():" + day);
	let hours = now.getHours();
	console.log("now.getHours():" + hours);
	let minutes = now.getMinutes();
	console.log("now.getMinutes():" + minutes);
	let seconds = now.getSeconds();
	console.log("now.getSeconds():" + seconds);
	let milliSeconds = now.getMilliseconds();
	console.log("now.getMillseconds():" + milliSeconds);
	let time = now.getTime();
	console.log("now.getTime():" + time);

	//第二种方式创建一个指定日期和时间的方法，解析一个符合 ISO 8601规范的字符串
	//返回时间戳
	let d1 = Date.parse('2015-06-24T19:49:22.875+08:00');
	console.log("时间戳:" + d1);
	let d2 = Date(d1);
	console.log("日期和时间:" + d2);

	//时区
	//Date对象按照浏览器所在时区显示时间，不过既可以是本地时间，也可以是调整后的UTC时间.
	let s = Date(1435146562875);
	let s1 = s.toLocaleString();
	console.log("s.toLocalString():" + s1);
	//let s2 = s.toUTCString();
	//console.log("s.toUTCString():" + s2);
</script>
</body>
</html>